package comxxxx.fallback;

import comxxxx.pojo.Product;
import comxxxx.service.ProductService;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author zzuli_huahua
 * @version 1.0
 * @date 2022/2/12 10:46
 */
@Component
public class ProductServiceFallblack implements ProductService {
    @Override
    public List<Product> selectProductList() {
        return Arrays.asList(
                new Product(1,"托底数据-华为手机",2,5888D),
                new Product(2,"托底数据-联想笔记本",1,6888D),
                new Product(3,"托底数据-小米平板电脑",5,2666D)
        );
    }

    @Override
    public List<Product> selectProductListByIds(List<Integer> ids) {
        List<Product> products = new ArrayList<>();
        ids.forEach(id -> products.add(new Product(id,"托底数据-电视级"+id,1,2666D)));
        return products;
    }

    @Override
    public Product selectProductListById(Integer id) {
        return new Product(id,"托底数据",1,2666D);
    }
}
